obda-mixer

Query Templates Syntax

A SPARQL template query is a SPARQL query with placeholders of the form

${id:source}

where id is an integer, and source is a string of the form table_name.col_name. During the test phase, OBDA-Mixer replaces the placeholders in the provided SPARQL templates to database values retrieved from the column table_name.col_name in the database. If p1, p2 are two placeholders retrieving values from columns in the same table, then the values for p1, p2 will be retrieved from the same row. If p1, p2 are two placeholders having the same source part and id part, then they will be replaced by the same value.

We now provide an example. Consider the following query 08.q from the NPD Benchmark:

PREFIX npdv: <http://sws.ifi.uio.no/vocab/npd-v2#>

SELECT *
WHERE {
  [ npdv:productionYear ?year ;
    npdv:productionMonth ?m ;
    npdv:producedGas     ?g ;
    npdv:producedOil     ?o 
 ]
 FILTER (?year > ${1:field_production_totalt_NCS_year.prfYear}) 
 FILTER(?m >= ${1:field_production_totalt_NCS_month.prfMonth} && ?m <= ${2:field_production_totalt_NCS_month.prfMonth} )
} 

Observe that the query contains three placeholders in the FILTER conditions. This query must be placed in the Templates folder.

The OBDA-Mixer instantiates the three placeholders with values retrieved from the columns field_production_totalt_NCS_month.[prfYear, month]; Observe that the second and the third placeholders will be instantiated to different values, although they have a common source part, since their id part differs.